/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package casino;

import java.util.Set;

/**
 * Class for the SevenReds player. His uses the martingale strategy but only places
 * bets after the wheel selects seven reds in a row.
 * 
 * @author amaghfur
 * @since 1.0
 */
public class SevenReds extends Martingale{
    
    /** keeps track of how many reds left to wait for before placing bet */
    private int redCount = 7;
    
    /**
     * Constructor for SevenReds.
     * 
     * @param tableToPlay 
     */
    public SevenReds(Table tableToPlay) {
        super(tableToPlay);
    }
    
    /**
     * Get player to place a bet after seeing seven reds in a row.
     */
    @Override
    public void placeBets() {
        if (redCount == 0) {
            super.placeBets();
            redCount = 7;
        }
    }
    
    /**
     * Notifies this player of the outcome of a spin so that he knows how many
     * more reds to wait for.
     * 
     * @param outcomes  spin outcomes
     */
    @Override
    public void winners(Set<Outcome> outcomes) {
        Outcome red = OutcomeFactory.getOutcomeFactory().createOutcome("Red", 1);
        if (outcomes.contains(red) == true)
            redCount--;
        else
            redCount = 7;
    }
    
    
}
